package com.qingke.Qiximybatis.business;

import org.apache.ibatis.session.SqlSession;
import com.qingke.Qiximybatis.QixiApp;
import com.qingke.Qiximybatis.QixiConsole;
import com.qingke.Qiximybatis.QixiDao;
import com.qingke.Qiximybatis.command.UserCommand;
import com.qingke.Qiximybatis.mapper.EducationMapper;
import com.qingke.Qiximybatis.sqlclass.Education;
import com.qingke.Qiximybatis.sqlclass.MyUser;

public class UpdateStudent7 extends UserCommand{
	
	public UpdateStudent7(MyUser user) {
		super(user);
	}
	
	@Override
	public void executeUserCommand() {
		SqlSession session = QixiDao.mybatisSession();
		System.out.println("这里是添加教育经历信息修改中心");
		
		Education edu = new Education();
		int userid = QixiApp.getInstance().getUser().getId();
		
		String school = QixiConsole.askUserInput("请输入school：");
		String major = QixiConsole.askUserInput("请输入major：");
		String degree = QixiConsole.askUserInput("请输入degree：");
		edu.setId(userid);
		edu.setSchool(school);
		edu.setMajor(major);
		edu.setDegree(degree);
		edu.setUserId(userid);
		EducationMapper eduM = session.getMapper(EducationMapper.class);
		eduM.Addeduction(edu);
		session.commit();
		System.out.println("添加记录成功！");
		session.close();
		
	}

}
